//
//  MYCover.m
//  奇闻
//
//  Created by 似水灵修 on 14-11-22.
//  Copyright (c) 2014年 MingYueGuCheng. All rights reserved.
//

#import "MYCover.h"

@implementation MYCover
+ (instancetype)show
{
    MYCover *cover = [[MYCover alloc] initWithFrame:MYKeyWindow.bounds];
    [MYKeyWindow addSubview:cover];
    return cover;
}
- (void)setDimBackground:(BOOL)dimBackground
{
    _dimBackground = dimBackground;
    if (self.isDimBackground) {
        self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.3;
    }
    else {
        self.backgroundColor = [UIColor clearColor];
        self.alpha = 1.0;
    }
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self removeFromSuperview];
    if (self.operateBlock) {
        self.operateBlock();
    }
}
@end
